home *** CD-ROM | disk | FTP | other *** search
/ C & C++ Multimedia Cyber Classroom / C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso / src / fig16_18.jar / Ch16 / Fig16_18 / Fig16_18.cpp
C/C++ Source or Header  |  1997-11-10  |  1KB  |  38 lines

  1. // Fig. 16.18: fig16_18.cpp
  2. // Using functions islower, isupper, tolower, toupper
  3. #include <iostream.h>
  4. #include <ctype.h>
  5.  
  6. int main()
  7. {
  8.    cout << "According to islower:\n"
  9.         << ( islower( 'p' ) ? "p is a" : "p is not a" ) 
  10.         << " lowercase letter\n"
  11.         << ( islower( 'P' ) ? "P is a" : "P is not a" ) 
  12.         << " lowercase letter\n"
  13.         << ( islower( '5' ) ? "5 is a" : "5 is not a" ) 
  14.         << " lowercase letter\n"
  15.         << ( islower( '!' ) ? "! is a" : "! is not a" ) 
  16.         << " lowercase letter\n";
  17.    cout << "\nAccording to isupper:\n"
  18.         << ( isupper( 'D' ) ? "D is an" : "D is not an" ) 
  19.         << " uppercase letter\n"
  20.         << ( isupper( 'd' ) ? "d is an" : "d is not an" ) 
  21.         << " uppercase letter\n"
  22.         << ( isupper( '8' ) ? "8 is an" : "8 is not an" ) 
  23.         << " uppercase letter\n"
  24.         << ( isupper('$') ? "$ is an" : "$ is not an" ) 
  25.         << " uppercase letter\n";
  26.    cout << "\nu converted to uppercase is " 
  27.         << ( char ) toupper( 'u' ) 
  28.         << "\n7 converted to uppercase is " 
  29.         << ( char ) toupper( '7' ) 
  30.         << "\n$ converted to uppercase is " 
  31.         << ( char ) toupper( '$' ) 
  32.         << "\nL converted to lowercase is " 
  33.         << ( char ) tolower( 'L' ) << endl;
  34.  
  35.    return 0;
  36. }
  37.  
  38.